import numpy as np
from cross_entropy_error import cross_entropy_error

def mini_batch_cross_entropy_error(y,t):
    delta = 1e-7
    if y.ndim == 1:
        y.reshape(1,y.size)
        t.reshape(1,t.size)
    batch_size = y.shape[0]
    for i in range(batch_size):
        tmp = 0
        tmp += cross_entropy_error(y,t)
    # return tmp/batch_size
    return "offical:",-np.sum(t*np.log(y+delta))/batch_size, "modified:",tmp/batch_size